﻿using System.IO;
using NUnrar;

namespace ComicTool.Model
{
    public class RarCompressedPage : Page
    {
        private RarArchiveEntry entry;

        internal RarCompressedPage(RarArchiveEntry entry)
        {
            this.entry = entry;
        }

        public override string Name
        {
            get
            {
                return entry.FilePath;
            }
        }

        public override byte[] ExtractBytes()
        {
            MemoryStream output = new MemoryStream();
            entry.WriteTo(output);
            output.Position = 0;
            return output.ToArray();
        }
    }
}
